package com.acme.bankapp.domain.bank;

public class SavingAccount extends AbstractAccount implements Account {

	public SavingAccount(double balance) {
		super(balance);
	}

	@Override
	public void withdraw(double amount) throws NotEnoughFundsException {
		if (this.balance >= amount) {
			this.balance -= amount;
		} else {
			throw new NotEnoughFundsException("Withdraw " + Double.toString(amount)
					+ " where balance " + Double.toString(this.balance));
		}
	}

	@Override
	public double maxAmountToWithdraw() {
		return this.getBalance();
	}
}
